package operation;

import book.Book;
import book.Booklist;

import java.util.Scanner;

public class Find implements IOoperation {
    public void work(Booklist book) {
        System.out.println("查找图书！");
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入你要查找的图书：");
        String bookName = sc.nextLine();
        int cnt= book.getCount();
        for (int i = 0; i < cnt; i++) {
            Book book1 = book.getBooks(i);
            if(book1.getName().equals(bookName)){
                System.out.println("找到了你查找的书--->"+bookName);
                return;
            }
            System.out.println("不存在该书--->"+bookName);
            break;
        }

    }
}
